import { ReturnResult } from '@/types/http';
import {
  httpGet,
  httpPost,
  httpPut,
  httpDelete,
} from '@/utils/http';

export function getFieldsGoodsList(
  page: number,
  pageSize: number,
  keyword: string
) {
  return httpGet<ReturnResult>({
    url: '/yixiantong-goods/list',
    params: {
      page,
      pageSize,
      keyword,
    },
  });
}

export function getFieldsGoodsDetail(id: string | number) {
  return httpGet<ReturnResult>({
    url: `/yixiantong-goods/${id}`,
    params: {},
  });
}

export function addFieldsGoodsDetail(formValue: Record<string, any>) {
  return httpPost<ReturnResult>({
    url: '/yixiantong-goods/',
    params: formValue
  });
}

export function editFieldsGoodsDetail(id: string | number, formValue: Record<string, any>) {
  return httpPut<ReturnResult>({
    url: `/yixiantong-goods/${id}`,
    params: formValue,
  });
}

export function deleteFieldsGoodsDetail(id: string | number) {
  return httpDelete<ReturnResult>({
    url: `/yixiantong-goods/${id}`,
    params: {},
  });
}
